import {Component, OnInit} from '@angular/core';
import {_HttpClient} from '@delon/theme';
import {SignupInfo} from '../signup-info';
import {SignupService} from '../signup.service';
import {NzMessageService} from 'ng-zorro-antd';

@Component({
    selector: 'app-signlist',
    templateUrl: './signlist.component.html',
})
export class SignlistComponent implements OnInit {

    total = 1;
    pagesize = 10;
    pageCurrent = 1;
    data: SignupInfo[] = [];


    constructor(
        private signService: SignupService,
        private msg: NzMessageService
    ) {
    }

    ngOnInit() {
        this.getlist(this.pageCurrent);
    }

    getlist($event) {
        this.signService.getSignList($event - 1).subscribe(res => {
            this.data = res['list'];
            this.pagesize = res['pageSize'];
            this.total = res['totalElement'];
            this.pageCurrent = $event;
        });
    }

    deal(item: SignupInfo) {
        this.signService.upSignUp(item['id']).subscribe(__ => {
            item['isDeal'] = 1;
            this.msg.success('处理成功');
        });

    }

}
